#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;

int n, m;

pii factors[N];
int num;
int vis[N];
void get_factors() {
  int x = n;
  for (ll i = 2; i * i <= x; i++) {
    if (x % i == 0) {
      int p = 0;
      while (x % i == 0) x /= i, p++;
      factors[++num] = pii(i, p);
    }
  }
  if (x > 1) factors[++num] = pii(x, 1);
}
ll ans = 0;
void dfs(int i, int res) {
  if (i > num) {
    int x = res;
    rep(j, 1, num) {
      if (!vis[j]) continue;
      int b = factors[j].first;
      x = x / b * (b - 1);
    }
    ans += n / res * x;
    return;
  }
  int b = factors[i].first, k = factors[i].second;
  int x = 1;
  rep(j, 0, k) {
    vis[i] = j != 0;
    dfs(i + 1, res * x);
    x *= b;
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  get_factors();
  dfs(1, 1);
  cout << ans;
  return 0;
}